package com.example.cpms.mapper;

import com.example.cpms.entity.Building;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BuildingMapper {

    /**
     * 查询全部建筑(弃用)
     * @return
     */
//    @Select("select * from building")
//    List<Building> list();

    /**
     * 根据id删除部门
     * @param id
     */
    @Delete("delete from building where id = #{id}")
    void deleteById(Integer id);

    /**
     * 新增楼宇
     * @param building
     */
    @Insert("insert into building(name,floors,area,propertyFeePrice,status) values(#{name},#{floors},#{area},#{propertyFeePrice},#{status})")
    void insert(Building building);

    /**
     * 编辑楼宇
     * @param building
     */
    @Update("update building set name = #{name}, floors = #{floors}, area = #{area}, propertyFeePrice = #{propertyFeePrice} where id = #{id} ")
    void update(Building building);


    /**
     *获得总记录数（改用插件实现）
//     * @return
     */
//    @Select("select count(*) from building")
//    public Long count();

    /**
     * 分页查询获取列表数据
//     * @param start
//     * @param pageSize
//     * @return
     */
//    @Select("select * from building limit #{start},#{pageSize}")
//    public List<Building> page(Integer start, Integer pageSize);
//

//    @Select("select * from building")
    public List<Building> list(@Param("name") String name);


}
